package Thread;
class MyThread4 extends Thread{
    @Override
    public void run() {
        while(true) {
            System.out.println("hello");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class ThreadDemo11 {
    public static void main(String[] args) throws InterruptedException {
   Thread t = new MyThread4();
    //没有创建新的线程，在主线程中执行
        //t.run();
    //创建了新线程，在新线程执行
         t.start();
        while(true){
            System.out.println("hello world");
            Thread.sleep(1000);
        }
    }
}
